Skip to content

Dict: gather dictionary values straight into a VarBinBuilder - #9098

Open
robert3005 wants to merge 1 commit into
rk/fsst-decode-into-builderfrom
rk/dict-gather-into-builder
Open

Dict: gather dictionary values straight into a VarBinBuilder#9098
robert3005 wants to merge 1 commit into
rk/fsst-decode-into-builderfrom
rk/dict-gather-into-builder

Conversation

@robert3005

@robert3005 robert3005 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Materialize dictionary values straight into VarBinBuilder instead of copying

Comment thread vortex-array/src/arrays/dict/vtable/mod.rs Outdated
@robert3005 robert3005 added the changelog/chore A trivial change label Jul 31, 2026
@robert3005
robert3005 marked this pull request as ready for review July 31, 2026 13:42
@robert3005
robert3005 force-pushed the rk/dict-gather-into-builder branch from 91142df to c82aa58 Compare July 31, 2026 18:11
@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.08%

❌ 1 regressed benchmark
✅ 1841 untouched benchmarks
⏩ 44 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation compact[(4096, 90)] 780.3 ns 867.8 ns -10.08%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/dict-gather-into-builder (e3cd801) with rk/fsst-decode-into-builder (4d3cb97)

Open in CodSpeed

Footnotes

  1. 44 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Appending a string dictionary to a builder went through `take_canonical`,
which first materializes the values at full logical length — allocating and
re-reading a views buffer proportional to the row count. The dictionary is
usually far smaller than the column, so resolving each code against it in place
skips that intermediate and leaves one `memcpy` per row.

The fast path indexes the codes and the dictionary's views and data buffers as
host slices, so `varbin_fast_path_is_host` gates it on residency; a
device-resident dictionary still takes the canonical route, where a device
kernel can serve it.

Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
robert3005 force-pushed the rk/dict-gather-into-builder branch from c82aa58 to e3cd801 Compare August 4, 2026 12:46
///
/// This is a handful of enum discriminant checks over the array's buffer handles, so it stays
/// outside the per-row loop and costs nothing measurable on the host-resident path.
fn varbin_fast_path_is_host(codes: &PrimitiveArray, values: &VarBinViewArray) -> bool {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't care about this check, it's guarded elsewhere

///
/// A code pointing at a null dictionary entry produces a null row, matching what
/// [`take_canonical`] derives from [`Validity::take`](crate::validity::Validity::take).
fn dict_validity<C: IntegerPType>(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just the validity of the array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant